package com.xyq.common.sucurity.config;

import com.xyq.common.sucurity.interceptor.ExtendTokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class TokenInterceptorConfig implements WebMvcConfigurer {
    @Autowired
    private ExtendTokenInterceptor extendTokenInterceptor ;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
          registry.addInterceptor(extendTokenInterceptor)
                  .addPathPatterns("/**")            // 所有的请求,处理login登录的都需要过这个拦截器
                  .excludePathPatterns("/**/login")
                  .excludePathPatterns("/**/test/**/")// 让test不继续拦截
                  .excludePathPatterns("/**/register/**/")
                  .excludePathPatterns("/**/noLogin/**/");
    }
}
